import zyRequest from "@/service";
import type { Account, LoginResult, DataType } from "./types";

enum LoginAPI {
  AccountLogin = "user/login",
  UserInfo = "user/searchUserById",
  UserMenus = "user/menusById",
}

class User {
  static accountLoginRequest(account: Account) {
    return zyRequest.post<DataType<LoginResult>>({
      url: LoginAPI.AccountLogin,
      data: account,
    });
  }

  static requsetUserInfoById() {
    return zyRequest.post<DataType>({
      url: LoginAPI.UserInfo,
      showLoading: false,
    });
  }

  static requsetUserMenuById() {
    return zyRequest.post<DataType>({
      url: LoginAPI.UserMenus,
      showLoading: false,
    });
  }
}

export default User;
